import greenfoot.*;  

public class StartButton extends Actor {
    private String difficulty;

    public StartButton(String difficulty) {
        this.difficulty = difficulty;
        setImage(new GreenfootImage(difficulty, 30, Color.WHITE, new Color(0,0,0,0)));
    }

    public void act() {
        if (Greenfoot.mouseClicked(this)) {
            int width = 0, height = 0, bombs = 0;

            switch (difficulty) {
                case "简单":
                    width = height = 9;
                    bombs = 10;
                    break;
                case "中等":
                    width = height = 16;
                    bombs = 40;
                    break;
                case "困难":
                    width = 16;
                    height = 30;
                    bombs = 99;
                    break;
            }
            
            Greenfoot.setWorld(new GameWorld(width, height, bombs));
        }
    }
}
